import unittest

from framework.output.file_output import FileOutput
from framework.core.crawler_result import Result


class FileOutputTestCase(unittest.TestCase):
    def test_something(self):
        output = FileOutput("D:/pt_spider_outputs/testing", loop_through=False)
        results = list()
        for i in range(2):
            r = Result.create(source_url="www.baidu.com", A=i, B="SCD", C=[456], D=[1, 2, 3], E=["A", "B", 3, "C"])
            results.append(r)
        output.dump(results)


if __name__ == '__main__':
    unittest.main()
